#ifndef IM2_COL_CUSTOM_TILING_H
#define IM2_COL_CUSTOM_TILING_H

#include "register/tilingdata_base.h"

namespace optiling {
constexpr int32_t USE_CORE_NUM = 8; // default core count

// 数据类型标志位定义
enum DataTypeFlag {
    DT_UINT8  = 0,   // uint8类型
    DT_INT16  = 1,   // int16类型
    DT_INT32  = 2,   // int32类型
    DT_FLOAT16 = 3,  // half类型
    DT_FLOAT  = 4    // float类型
};

BEGIN_TILING_DATA_DEF(Im2ColCustomTilingData)
    // 基础计算参数
    TILING_DATA_FIELD_DEF(int32_t, N);
    TILING_DATA_FIELD_DEF(int32_t, C);
    TILING_DATA_FIELD_DEF(int32_t, H);
    TILING_DATA_FIELD_DEF(int32_t, W);
    TILING_DATA_FIELD_DEF(int32_t, kernel_h);
    TILING_DATA_FIELD_DEF(int32_t, kernel_w);
    TILING_DATA_FIELD_DEF(int32_t, stride_val);
    TILING_DATA_FIELD_DEF(int32_t, padding_val);
    TILING_DATA_FIELD_DEF(int32_t, out_H);
    TILING_DATA_FIELD_DEF(int32_t, out_W);
    TILING_DATA_FIELD_DEF(int32_t, L);
    TILING_DATA_FIELD_DEF(int32_t, output_channels);

    // 核间划分
    TILING_DATA_FIELD_DEF(uint64_t, input_elements);
    TILING_DATA_FIELD_DEF(uint64_t, output_elements);
    TILING_DATA_FIELD_DEF(uint32_t, total_output_elements);
    TILING_DATA_FIELD_DEF(int32_t, base_elements_per_core);
    TILING_DATA_FIELD_DEF(int32_t, big_core_num);
    TILING_DATA_FIELD_DEF_ARR(int32_t, USE_CORE_NUM, core_element_start);
    TILING_DATA_FIELD_DEF_ARR(int32_t, USE_CORE_NUM, core_element_end);
    TILING_DATA_FIELD_DEF_ARR(int32_t, USE_CORE_NUM, core_element_count);

    // 核内划分（tile）
    TILING_DATA_FIELD_DEF(int32_t, tile_element_num);
    TILING_DATA_FIELD_DEF_ARR(int32_t, USE_CORE_NUM, core_loop_times);
    TILING_DATA_FIELD_DEF_ARR(int32_t, USE_CORE_NUM, core_tail_elements);

    // 对齐与内存
    TILING_DATA_FIELD_DEF(int32_t, aligned_element_size); // 对齐后的元素数
    TILING_DATA_FIELD_DEF(int32_t, bufferNum); // 通常2

END_TILING_DATA_DEF;

REGISTER_TILING_DATA_CLASS(Im2ColCustom, Im2ColCustomTilingData)
} // namespace optiling
#endif // IM2_COL_CUSTOM_TILING_H